home *** CD-ROM | disk | FTP | other *** search
/ stazsoftware.com / www.stazsoftware.com.tar / www.stazsoftware.com / futurebasic / sample-code / helpProj.sit / Help Project Folder / Help Project.MAIN < prev    next >
Text File  |  2005-04-15  |  7KB  |  326 lines

  1.  
  2. '~'
  3. /* 
  4.      ".MAIN" file for Program Generator
  5.      Adapted for use with FB^3 
  6.      02/18/99 - Chris Stasny
  7. */
  8. '~'
  9.  
  10. RESOURCES "","APPLpG3!"
  11. 'WIDTH -2
  12.  
  13. '~'
  14. '{PG3} <--  Do not remove.
  15. END GLOBALS
  16. '{PGÑ}
  17. /*
  18.      Any code placed between these PGÑ markers will not be
  19.      disturbed when you resave your project in Program Generator
  20. */
  21. '{PGÑ}
  22. EDIT = 2
  23. '{PG4}
  24. '~'
  25.  
  26.  
  27. '~Prototypes
  28. /*
  29.      The following prototypes allow forward 
  30.      referenceing of functions in them .MAIN
  31. */
  32. def fn mainActions
  33. def fn menuActions
  34. def fn buttonActions
  35. def fn mouseActions
  36. def fn windowActions
  37. def fn fieldActions
  38. def fn otherActions
  39.  
  40.  
  41. '~Action Branch (gAction)
  42. SELECT gAction
  43. CASE _mainAction   :fn mainActions
  44. CASE _menuAction   :fn menuActions
  45. CASE _buttonAction :fn buttonActions
  46. CASE _mouseAction  :fn mouseActions
  47. CASE _windowAction :fn windowActions
  48. CASE _fieldAction  :fn fieldActions
  49. CASE _otherAction  :fn otherActions
  50. END SELECT:RETURN
  51.  
  52.  
  53. '~Main Actions
  54.  
  55. local fn mainActions
  56. '~'
  57.  
  58. SELECT gSubAction
  59.  
  60. CASE _mainStart
  61.  
  62. /*
  63.      Do any set up here for your program's
  64.      initialization. At this point, all of PG's
  65.      vars and functions have been initialized.
  66.  
  67.  
  68.      You can open a window in PG with "FN pGbuild(_theWindow)"
  69.      If you change the constant name of the first window,
  70.      you must also change the constant in the following line.
  71.  
  72. */
  73.  
  74. gTopic$ = "1 Introduction"
  75. FN BuildHelpWindow
  76.  
  77.  
  78. CASE _mainOpen
  79.  
  80. /*
  81.      You need to open a file. The name of the
  82.      file is gFileName$ (temp variable). The volume
  83.      reference number is stored in gFileVol (temp var).
  84.      If you want to store this information, use 
  85.      
  86.      gSaveName$    = gFileName$
  87.      gSaveVol      = gFileVol
  88.      gIsStationery = Bool: Is this stationery?
  89. */
  90.  
  91. CASE _mainSave
  92. CASE _mainPrint
  93. CASE _mainTimer
  94. CASE _mainShutDown
  95. CASE _mainGoodBye
  96. END SELECT
  97. end fn
  98.  
  99.  
  100. '~Menu Actions
  101.  
  102. local fn menuActions
  103. '~'
  104.  
  105. /*
  106.      gWhichMenu is the ID of the menu selected
  107.      gWhichItem is the item number
  108. */
  109.  
  110. SELECT gWhichMenu
  111. CASE _appleResMenu
  112.  
  113. END SELECT
  114.  
  115. end fn
  116.  
  117.  
  118. '~Button Actions
  119.  
  120. local fn buttonActions
  121. '~'
  122. /* 
  123.      gWhichClass    = The window
  124.      gWhichButton   = button reference number
  125.      gButtonValue   = current value (after toggle of
  126.                       checkboxes and radio buttons)
  127.      gControlTitle$ = name of button
  128. */
  129.  
  130. SELECT gWhichClass
  131. END SELECT
  132. end fn
  133.  
  134.  
  135. '~Mouse Actions
  136.  
  137. local fn mouseActions
  138. '~'
  139. /* 
  140.      gWhichClass    = The window
  141.      gMouseY%       = local y coordinate
  142.      gMouseX%       = local x coordinate
  143.      gMouseLong&    = synonym for gMouseY%,gMouseX%
  144.      gWhereY%       = global y coordinate
  145.      gWhereX%       = global x coordinate
  146.      gClickStatus   = 0: up
  147.                       1: single-click (-1: and still down)
  148.                       2: double-click (-2: and still down)
  149.                       3: triple-click (-3: and still down)
  150.      gModifiers     = which modifier keys where pressed
  151.      gWhen&         = the tickcount when this click occurred
  152. */
  153.  
  154. SELECT gWhichClass
  155.  
  156. END SELECT
  157. end fn
  158.  
  159.  
  160. '~Window Actions
  161.  
  162. local fn windowActions
  163. '~'
  164. /* 
  165.      gWhichClass    = The type of window
  166.      gWhichWindow   = the actual window reference number
  167.      gActWindow%    = the active (frontmost) window
  168.      gActiveDoc     = synonym for gActWindow%
  169.      gOutWindow%    = window where drawing will occur
  170.      gActPalette%   = frontmost floating palette
  171.      gWindowTitle$  = window title
  172.  
  173.      gWndTypeList&(gWhichWindow)
  174.                     = 4 character type set up in PG's Window 
  175.                       attributes dialog (_TEXT",_PICT",_"NVIS")
  176.      gWndDataHndl&(gWhichWindow) - Normally used by filters
  177.                     = long integer for storing window info
  178.  
  179.      gWndDirty(gWhichWindow)     - For your use
  180.                     = Bool: Is window dirty?
  181.      gWndInfo&(gWhichWindow)     - For your use
  182.                     = long integer for storing window info
  183. */
  184.  
  185. SELECT gSubAction
  186. CASE _windowClose
  187. CASE _windowUpdate
  188. CASE _windowActivate
  189. CASE _windowDeactivate
  190. CASE _windowSized
  191. CASE _windowMoved
  192. CASE _windowClicked
  193. CASE _windowWillZoomOut
  194. CASE _windowWillZoomIn
  195. CASE _windowWillGrow
  196. CASE _windowDocWillMove
  197. END SELECT
  198. end fn
  199.  
  200.  
  201. '~Field Actions
  202.  
  203. local fn fieldActions
  204. '~'
  205. /* 
  206.      gWhichClass    = The window
  207.      gWhichField%   = field reference number
  208.      gFieldWas      = last field ref number was╔
  209. */
  210.  
  211. SELECT gSubAction
  212. CASE _fieldActivate
  213. CASE _fieldChanging
  214. CASE _fieldKeyPressed
  215. CASE _fieldReturn
  216. CASE _fieldTab
  217. CASE _fieldShiftTab
  218. CASE _fieldClear
  219. CASE _fieldLeft
  220. CASE _fieldRight
  221. CASE _fieldUp
  222. CASE _fieldDown
  223. CASE _fieldClicked
  224. END SELECT
  225. end fn
  226.  
  227.  
  228. '~Other Actions
  229.  
  230. local fn otherActions
  231. '~'
  232. SELECT gSubAction
  233. CASE _otherDisk
  234. gAction = 0
  235. /*
  236.      A disk was inserted.
  237.      If "gAction=0" is removed, PG shows standard files dialog.
  238. */
  239.  
  240. CASE _otherSwitch'background switch
  241. /*
  242.      gInBackground = boolean
  243.      gDialogValue  = _MFResume     returned to foreground
  244.                      _MFSuspend    sent to background
  245.                      _MFClipboard  same as _MFResume, but clipboard
  246.                                    has been modified
  247.                      _MFMouse      if event record contains mouse region,
  248.                                    this is a mouse out of region message
  249. */
  250.  
  251. CASE _otherScrap
  252. /*
  253.      response to _MFClipboard above
  254. */
  255.  
  256. CASE _otherCursor
  257. /* 
  258.      gWhichClass    = cursor over this window type
  259.      gWhichWindow   = cursor over this window
  260.      gActWindow%    = the active (frontmost) window
  261.      gActiveDoc     = synonym for gActWindow%
  262.      gOutWindow%    = window where drawing will occur
  263.      gActPalette%   = frontmost floating palette
  264.      gMouseY%       = local y coordinate
  265.      gMouseX%       = local x coordinate
  266.      gMouseLong&    = synonym for gMouseY%,gMouseX%
  267.      gWhereY%       = global y coordinate
  268.      gWhereX%       = global x coordinate
  269.      gWhichButton or gWhichField     
  270.         if negative = cursor over this field
  271.         if positive = cursor over this button
  272.         if zero     = not over any button or field
  273.  
  274. */
  275.  
  276. CASE _otherKeyPressed
  277. /*
  278.      A key was pressed, but no edit field is active.
  279.      gKey$ = the key
  280. */
  281.  
  282. CASE _otherBeforeMenu
  283. /*
  284.      A command key sequence was pressed or the user clicked
  285.      in the menu bar. Enable/disable menus here.
  286. */
  287.  
  288. CASE _otherNullEvent
  289. /* 
  290.      The system is idle.
  291.      gEventPtr& = pointer to event record
  292.      gWhat%     = always zero for nulls
  293.      gMessage&  = see Inside Macintosh
  294.      gWhen&     = current tickcount
  295.      gWhereY%   = global y coordinate
  296.      gWhereX%   = global x coordinate
  297.      gModifiers = modifier keys
  298. */
  299.  
  300. CASE _otherFilterEvent
  301. /*
  302.      This is the same as _otherNullEvent above except that
  303.      gWhat equals the event. This message is sent before FB
  304.      processes anything. You can erase the event with: % EVENT,0.
  305. */
  306.  
  307. CASE _otherUser
  308. /* 
  309.      A message was sent via     DIALOG% = yourMessage%
  310.                                 DIALOG& = yourData&
  311. */
  312.  
  313.  
  314.  
  315. /* 
  316.      These actions relate to custom user items
  317. */
  318. CASE _otherUserInit'init the item
  319. CASE _otherUserUpdate'draw the item
  320. CASE _otherUserClick'mouse was clicked in the item
  321. CASE _otherUserDispose'dispose of the item
  322. END SELECT
  323. end fn
  324.  
  325.  
  326.